﻿using AppsModel.Models;
using MVC_basic.Data_Layer.Interface;
using MVC_basic.Helpers;
using MVC_basic.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;

namespace MVC_basic.Controllers
{
    public class CanvasController : Controller
    {
        private readonly IdbApp db;
        public CanvasController(IdbApp DIdb)
        {
            db = DIdb;
            WebSecurity_Singleton.init();
        }

        public ActionResult Index(int id)
        {
            CanvasApp app = (CanvasApp)db.getApp(id);
            db.installApp(id, 1);
            @ViewBag.UserId = WebSecurity.GetUserId(User.Identity.Name);
            return View(app);
        }

        private void sendUserInfo()
        {

        }

    }
}
